package leetcode.code1704;

import java.util.List;

import leetcode.IDebug;
import leetcode.helper.H;

public class Solution2 implements IDebug {

	static Character[] aeiou = new Character[] { 'a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U' };
	static List<Character> list;
	static {
		list = List.of(aeiou);
	}

	public boolean halvesAreAlike(String s) {
		int cnt = 0;
		for (int i = 0, l = 0, r = s.length() - 1; i < s.length() >>1; i++, l++, r--) {
			cnt += list.contains(s.charAt(l)) ? 1 : 0;
			cnt -= list.contains(s.charAt(r)) ? 1 : 0;
		}
		return cnt == 0;
	}

	@Override
	public void debug4() {
		H.compare(true, this.halvesAreAlike("book"));

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		Solution2 so = new Solution2();
		so.debug1();
		so.debug2();
		so.debug3();
		so.debug4();

	}

}
